<html>
<head>
    <title>Canvas tutorial</title>
    <script type="text/javascript">
        function draw(){
            var canvas = document.getElementById('tutorial');
            console.log(canvas);
            if (canvas.getContext){
                var ctx = canvas.getContext('2d');
                console.log(ctx);
            }
        }
    </script>
    <style type="text/css">
        canvas { border: 1px solid black; }
    </style>
</head>
<body onload="draw();">
<canvas id="tutorial" width="150" height="150"></canvas>
</body>
</html>